//////////////////////////////////////////////////////////////////////////
#pragma once
#pragma managed
//////////////////////////////////////////////////////////////////////////
NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////
public ref class ManagedVideoWriter : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvVideoWriter* pVideoWriter = this->ToCvVideoWriterPointer();
		cvReleaseVideoWriter(&pVideoWriter);
		m_pHandle = pVideoWriter;
	}

internal:
	ManagedVideoWriter(CvVideoWriter* handle, bool own) : NativeHandleObject(handle, own)
	{

	}

	CvVideoWriter* ToCvVideoWriterPointer()
	{
		return (CvVideoWriter*)m_pHandle;
	}
};

public ref class ManagedCapture : public NativeHandleObject
{
protected:
	virtual void ReleaseHandle() override
	{
		CvCapture* pCapture = this->ToCvCapturePointer();
		cvReleaseCapture(&pCapture);
		m_pHandle = pCapture;
	}

internal:
	ManagedCapture(CvCapture* handle, bool own) : NativeHandleObject(handle, own)
	{

	}

	CvCapture* ToCvCapturePointer()
	{
		return (CvCapture*)m_pHandle;
	}
};
//////////////////////////////////////////////////////////////////////////
NAMESPACE_END
//////////////////////////////////////////////////////////////////////////